package com.open.capacity.finance.constant;

import com.fasterxml.jackson.annotation.JsonCreator;

public enum SourceImportResult {

    DOING(0, "进行中"),
    SUCCESS(1, "成功"),
    FAIL(-1, "失败");


    private int code;
    private String text;

    SourceImportResult(int code, String text) {
        this.code = code;
        this.text = text;
    }

    public int getCode() {
        return this.code;
    }

    public String getText() {
        return this.text;
    }

    @JsonCreator
    public static SourceImportResult valueOfEnum(int code) {

        SourceImportResult[] bss = values();

        for (SourceImportResult bs : bss) {
            if (bs.getCode() == code) {
                return bs;
            }
        }

        throw new IllegalArgumentException("code:" + code + "不存在!");
    }
}
